/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 23735
 * Date: 2023-10-24
 * Time: 22:11
 */
import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int count = in.nextInt();
            String s = in.next();
            int[] arr = new int[count];
            int index = 0;
            int start = 0;
            int len = s.length();
            for (int i = 0; i < len; i++) {
                char c = s.charAt(i);
                if (c == 'U') {
                    // U 向上, 下标 -1
                    if (index == start) {
                        // 只有 index == start, 并且向上时时 start 才变
                        if (index == 0) {
                            // 从第一个变为最后一个
                            start = count - 4;
                        } else {
                            start--;
                        }
                    }
                    index = (index - 1 + count) % count;
                } else {
                    // D 向下, 下标 +1
                    if (index - 3 == start) {
                        // 只有 index 为下边界, 并且向下时 start 才变
                        if (index == count - 1) {
                            // 从最后一个变为第一个
                            start = 0;
                        } else {
                            start++;
                        }
                    }
                    index = (index + 1) % count;
                }
            }
            if (count <= 4) {
                for (int i = 1; i <= count; i++) {
                    System.out.print(i + " ");
                }
            } else {
                for (int i = 1; i <= 4; i++) {
                    System.out.print((start+i) + " ");
                }
            }
            System.out.println();
            System.out.println(index+1);
        }
    }
}